package com.beaut.project.service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.beaut.project.dao.GDMapper;
import com.beaut.project.dao.GroupMapper;
import com.beaut.project.dao.SMSMapper;
import com.beaut.project.dao.WareHouseMapper;
import com.beaut.project.dao.XMFinanceMapper;
import com.beaut.project.dao.XMMapper;
import com.beaut.project.util.SMSUtil;
import com.beaut.project.util.StaticData;

@Transactional(rollbackFor = Exception.class)
@Component
public class AlarmService {
	@Autowired
	private GDMapper gdMapper;
	@Autowired
	private SMSMapper smsMapper;
	@Autowired
	private XMMapper xmMapper;
	@Autowired
	private GroupMapper groupMapper;
	@Autowired
	private WareHouseMapper warehouseMapper;
	@Autowired
	private XMFinanceMapper xmFinanceMapper;
	
	/**
	 * 工单完工时间的预警提醒(0 < status < 6),如果当前时间大于等于设置的预警时间，则添加一条提醒
	 */
	@Scheduled(cron="0 0 1  * * ? ")   //每天凌晨1点执行一次
//	@Scheduled(cron="0/20 * *  * * ? ")   //每20秒执行一次 
	public void gdAlarm(){
		Map<String,Object> queryMap = new HashMap<String,Object>();
		String now = new SimpleDateFormat(StaticData.DATE_FORMATTER).format(new Date());
		queryMap.put("now", now);
		queryMap.put("start", StaticData.START);
		queryMap.put("accouting", StaticData.ACCOUTING);
		List<Map<String,Object>> list = gdMapper.getGDAlarm(queryMap);
		if(list != null && list.size() > 0){
			for(int i=0;i < list.size();i++){
				Map<String,Object> m = list.get(i);
				//添加消息提醒
				String create_user_id = "-1";//"-1"表示系统提醒
				String recieve_user_id = String.valueOf(m.get("gd_admin_id"));
				int sms_module = SMSUtil.SMS_GD_FINISH_ALARM;
				String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
				String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
				//预警链接
				String sms_link = "springViews/gd/alarmMyGD.jsp";
				String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
				Map<String,Object> smsMap = new HashMap<String,Object>();
				smsMap.put("create_user_id", create_user_id);
				smsMap.put("recieve_user_id", recieve_user_id);
				smsMap.put("sms_module", sms_module);
				smsMap.put("sms_title", sms_title);
				smsMap.put("sms_body", sms_body);
				smsMap.put("sms_link", sms_link);
				smsMap.put("create_time", create_time);
				smsMapper.addSMS(smsMap);
			}
		}
	}
	/**
	 * 项目进度开票回款预警提醒(当前开票额如果大于已收金额，从预警时间开始每天产生一条提醒，直到全部收完)
	 */
	@Scheduled(cron="0 10 1  * * ? ")  
	public void xmInvoiceAlarm(){
		Map<String,Object> queryMap = new HashMap<String,Object>();
		String now = new SimpleDateFormat(StaticData.DATE_FORMATTER).format(new Date());
		queryMap.put("now", now);
		List<Map<String,Object>> list = xmMapper.getXMInvoiceAlarm(queryMap);
		if(list != null && list.size() > 0){
			for(int i=0;i < list.size();i++){
				Map<String,Object> m = list.get(i);
				//添加消息提醒
				String create_user_id = "-1";
				String recieve_user_id = String.valueOf(m.get("creator_id"));
				int sms_module = SMSUtil.SMS_XM_INVOICE_ALARM;
				String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
				String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
				//预警链接
				String sms_link = "springViews/xm/tabInvoiceInMoney.jsp";
				String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
				Map<String,Object> smsMap = new HashMap<String,Object>();
				smsMap.put("create_user_id", create_user_id);
				smsMap.put("recieve_user_id", recieve_user_id);
				smsMap.put("sms_module", sms_module);
				smsMap.put("sms_title", sms_title);
				smsMap.put("sms_body", sms_body);
				smsMap.put("sms_link", sms_link);
				smsMap.put("create_time", create_time);
				smsMapper.addSMS(smsMap);
			}
		}
	}
	/**
	 * 项目结算开票回款预警提醒(当前开票额如果大于已收金额，从预警时间开始每天产生一条提醒，直到全部收完)
	 */
	@Scheduled(cron="0 15 1  * * ? ")
	public void xmInvoiceEndAlarm(){
		Map<String,Object> queryMap = new HashMap<String,Object>();
		String now = new SimpleDateFormat(StaticData.DATE_FORMATTER).format(new Date());
		queryMap.put("now", now);
		List<Map<String,Object>> list = xmMapper.getXMInvoiceEndAlarm(queryMap);
		if(list != null && list.size() > 0){
			for(int i=0;i < list.size();i++){
				Map<String,Object> m = list.get(i);
				//添加消息提醒
				String create_user_id = "-1";
				String recieve_user_id = String.valueOf(m.get("creator_id"));
				int sms_module = SMSUtil.SMS_XM_INVOICE_END_ALARM;
				String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
				String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
				//预警链接
				String sms_link = "springViews/xm/tabInvoiceInMoneyEnd.jsp";
				String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
				Map<String,Object> smsMap = new HashMap<String,Object>();
				smsMap.put("create_user_id", create_user_id);
				smsMap.put("recieve_user_id", recieve_user_id);
				smsMap.put("sms_module", sms_module);
				smsMap.put("sms_title", sms_title);
				smsMap.put("sms_body", sms_body);
				smsMap.put("sms_link", sms_link);
				smsMap.put("create_time", create_time);
				smsMapper.addSMS(smsMap);
			}
		}
	}
	/**
	 * 质保金回收提醒
	 */
	@Scheduled(cron="0 20 1  * * ? ")
	public void xmWarrantyAlarm(){
		Map<String,Object> queryMap = new HashMap<String,Object>();
		String now = new SimpleDateFormat(StaticData.DATE_FORMATTER).format(new Date());
		queryMap.put("now", now);
		List<Map<String,Object>> list = xmMapper.getXMWarrantyAlarm(queryMap);
		if(list != null && list.size() > 0){
			for(int i=0;i < list.size();i++){
				Map<String,Object> m = list.get(i);
				//添加消息提醒
				String create_user_id = "-1";
				String recieve_user_id = String.valueOf(m.get("creator_id"));
				int sms_module = SMSUtil.SMS_XM_WARRANTY;
				String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
				String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
				//预警链接
				String sms_link = "springViews/xm/tabInvoiceInMoneyEnd.jsp";
				String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
				Map<String,Object> smsMap = new HashMap<String,Object>();
				smsMap.put("create_user_id", create_user_id);
				smsMap.put("recieve_user_id", recieve_user_id);
				smsMap.put("sms_module", sms_module);
				smsMap.put("sms_title", sms_title);
				smsMap.put("sms_body", sms_body);
				smsMap.put("sms_link", sms_link);
				smsMap.put("create_time", create_time);
				smsMapper.addSMS(smsMap);
			}
		}
	}
	/**
	 * 采购待办提醒
	 */
	@Scheduled(cron="0 25 1  * * ? ")
	public void gdPurchase(){
		List<Map<String,Object>> list= warehouseMapper.getGDPurchaseApply();
		if(list != null && list.size() > 0){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.WAREHOUSE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_GD_PURCHASE_APPLY;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/warehouse/gdPurchaseApplyManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	/**
	 * 待办订货单提醒
	 */
	@Scheduled(cron="0 30 1  * * ? ")
	public void gdPurchaseProduct(){
		List<Map<String,Object>> list= warehouseMapper.getPurchase();
		if(list != null && list.size() > 0){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.WAREHOUSE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_GD_PURCHASE;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/warehouse/gdPurchaseManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	/**
	 * 待办入库提醒
	 */
	@Scheduled(cron="0 35 1  * * ? ")
	public void gdPurchaseProductIn(){
		List<Map<String,Object>> list= warehouseMapper.getPurchaseProductIn();
		if(list != null && list.size() > 0){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.WAREHOUSE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_GD_PURCHASE_PRODUCT_IN;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/warehouse/gdPurchaseProductInManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	/**
	 * 员工借款支付提醒通知
	 */
	@Scheduled(cron="0 40 1  * * ? ")
	public void gdLoan(){
		List<Map<String,Object>> list= gdMapper.getGdLoan();
		if(list != null && list.size() > 0){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.FINANCE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_GD_LOAN;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/finance/financeGdLoanManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	/**
	 * 班组垫款支付提醒通知
	 */
	@Scheduled(cron="0 45 1  * * ? ")
	public void gdAdvances(){
		List<Map<String,Object>> list= gdMapper.getFinanceGdAdvances();
		if(list != null && list.size() > 0){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.FINANCE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_GD_ADVANCE;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/finance/financeGdAdvancesManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	/**
	 * 班组垫款还款提醒通知
	 */
	@Scheduled(cron="0 50 1  * * ? ")
	public void gdYetAdvances(){
		List<Map<String,Object>> list= gdMapper.getGdYetAdvance();
		if(list != null && list.size() > 0){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.FINANCE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_GD_YET_ADVANCE;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/finance/financeGdYetAdvancesManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	/**
	 * 项目收款待办提醒通知
	 */
	@Scheduled(cron="0 55 1  * * ? ")
	public void xmEarn(){
		List<Map<String,Object>> list= xmFinanceMapper.getXMFinanceEarn();
		if(list != null && list.size() > 0){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.FINANCE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_XM_FINANCE_EARN;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/finance/financeXMEarnManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	/**
	 * 项目支付待办提醒通知
	 */
	@Scheduled(cron="0 0 2  * * ? ")
	public void xmPayment(){
		List<Map<String,Object>> list= xmFinanceMapper.getXMFinancePayment();
		if(list != null && list.size() > 0){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.FINANCE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_XM_FINANCE_PAYMENT;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/finance/financeXMPayManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	/**
	 * 项目报账待办提醒通知
	 */
	@Scheduled(cron="0 5 2  * * ? ")
	public void xmReim(){
		Map<String,Object> queryMap = new HashMap<String,Object>();
		queryMap.put("flagType", 2);
		List<Map<String,Object>> list1= xmFinanceMapper.getXmReim(queryMap);
		queryMap.put("yet_status", 1);
		queryMap.put("flagType", 1);
		List<Map<String,Object>> list2= xmFinanceMapper.getXmReim(queryMap);
		if((list1 != null && list1.size() > 0) || (list2 != null && list2.size() > 0)){
			//添加消息提醒
			String create_user_id = "-1";
			String priv_name = SMSUtil.FINANCE_ADMIN;
			List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
			if(recieveList != null && recieveList.size() > 0){
				for(int i=0;i<recieveList.size();i++){
					int sms_module = SMSUtil.SMS_XM_FINANCE_REIM;
					String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
					String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
					//预警链接
					String sms_link = "springViews/finance/financeXmReimbursementManage.jsp";
					String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
					Map<String,Object> smsMap = new HashMap<String,Object>();
					smsMap.put("create_user_id", create_user_id);
					smsMap.put("recieve_user_id", recieveList.get(i));
					smsMap.put("sms_module", sms_module);
					smsMap.put("sms_title", sms_title);
					smsMap.put("sms_body", sms_body);
					smsMap.put("sms_link", sms_link);
					smsMap.put("create_time", create_time);
					smsMapper.addSMS(smsMap);
				}
			}
		}
	}
	
	/**
	 * 工单交底完成后通知安质员---交底完成之后通知一次
	 */
	public void gdDescriptionAlarm(Map<String,Object> map){
		Map<String,Object> mapDesc = gdMapper.getGdDescriptionAlarm(map);
		if(mapDesc != null ){
				//添加消息提醒
				String create_user_id = String.valueOf(map.get("person_id"));
				String priv_name = SMSUtil.AZ_ADMIN;
				List<String> recieveList = groupMapper.getUsersByPrivName(priv_name);
				if(recieveList != null && recieveList.size() > 0){
					for(int i=0;i<recieveList.size();i++){
						int sms_module = SMSUtil.SMS_GD_DESCRIPTION;
						String sms_title = SMSUtil.getSMSModuleNameByKey(sms_module);
						String sms_body = SMSUtil.getSMSModuleNameByKey(sms_module);
						//预警链接
						String sms_link = "springViews/gd/gdDescription.jsp?callback=rtCallBack&gd_id="+mapDesc.get("id")+"&gd_content_id="+map.get("gd_content_id")+"&gd_code="+mapDesc.get("gd_code")+"&gd_name="+mapDesc.get("gd_name");
						String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
						Map<String,Object> smsMap = new HashMap<String,Object>();
						smsMap.put("create_user_id", create_user_id);
						smsMap.put("recieve_user_id", recieveList.get(i));
						smsMap.put("sms_module", sms_module);
						smsMap.put("sms_title", sms_title);
						smsMap.put("sms_body", sms_body);
						smsMap.put("sms_link", sms_link);
						smsMap.put("create_time", create_time);
						smsMapper.addSMS(smsMap);
					}
				}
		}
	}
	/**
	 * 添加了安质记录通知工单管理员
	 */
	public void gdAlarmSecurity(Map<String,Object> map){
		//添加消息提醒，通知工单管理员
				String gd_id = String.valueOf(map.get("gd_id"));
				Map<String,Object> gdBaseMap = gdMapper.getGDBaseById(map);
				String create_user_id = String.valueOf(map.get("person_id"));
				String recieve_user_id = String.valueOf(gdBaseMap.get("gd_admin_id"));
				int sms_module = SMSUtil.SMS_GD_SECURITY;
				String sms_title = String.valueOf(map.get("title"));
				String sms_body = String.valueOf(map.get("title"));
				String sms_link = "springViews/gd/securityCheckManage.jsp?gd_id="+gd_id+"&gd_name="+String.valueOf(gdBaseMap.get("gd_name"))+"&gd_code="+String.valueOf(gdBaseMap.get("gd_code"));
				String create_time = new SimpleDateFormat(StaticData.OPERATION_DATE_FORMATTER).format(new Date());
				Map<String,Object> smsMap = new HashMap<String,Object>();
				smsMap.put("create_user_id", create_user_id);
				smsMap.put("recieve_user_id", recieve_user_id);
				smsMap.put("sms_module", sms_module);
				smsMap.put("sms_title", sms_title);
				smsMap.put("sms_body", sms_body);
				smsMap.put("sms_link", sms_link);
				smsMap.put("create_time", create_time);
				smsMapper.addSMS(smsMap);
		}
}
